FILE(GLOB LIBS_DIR "*")

# Searching for libraries (a sub-directory with a "CMakeLists.txt" file)
SET(SUB_DIRS "")
FOREACH(A_DIR ${LIBS_DIR})
    IF(EXISTS "${A_DIR}/CMakeLists.txt")
        FILE(RELATIVE_PATH LIBNAME "${ClusterVirtualisation_SOURCE_DIR}/libs" ${A_DIR})
        MESSAGE(STATUS "Adding library: ${LIBNAME}")
        LINK_DIRECTORIES(${A_DIR})
        SUBDIRS(${LIBNAME})
        IF("${SUB_DIRS}" STREQUAL "")
            SET(SUB_DIRS "${LIBNAME}")
        ELSE("${SUB_DIRS}" STREQUAL "")
            SET(SUB_DIRS "${SUB_DIRS} ${LIBNAME}")
        ENDIF("${SUB_DIRS}" STREQUAL "")
    ENDIF(EXISTS "${A_DIR}/CMakeLists.txt")
ENDFOREACH(A_DIR)
